<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Animate.css库</title>
  <script src="./vue.js"></script>
  <link rel="stylesheet" type="text/css" href="./animate.css">
  <style>
    /* @keyframes bounce-in {
      0% {
        transform: scale(0);
      }
      50% {
        transform: scale(1.5);
      }
      100% {
        transform: scale(1);
      }
    }
    .fade-enter-active {
      transform-origin: left center;
      animation: bounce-in 1s;
    }
    .fade-leave-active {
      transform-origin: left center;
      animation: bounce-in 1s reverse;
    } */
    .fade-enter, .fade-leave-to {
      opacity: 0;
    }
    .fade-enter-active, .fade-leave-active {
      transition: 3s;
    }
  </style>
</head>
<body>
  <div id="root">
    <!-- 书写样式中简写成enter，标签中可以写enter-active-class="enter"  -->
    <!-- appear解决 页面第一次进入时候没有动画的问题 -->
    <!-- 同时有过渡动画和animate动画的时候，且两者动画播放时长不一样，可以通过type="transition"
      控制播放时长 或者通过属性 :duration="10000"自定义播放时长-->
    <transition name="fade" 
        :duration="3000"
        appear
        enter-active-class="animated wobble  fade-enter-active" 
        leave-active-class="animated wobble fade-leave-active"
        appear-active-class="animated wobble"
        >
        <div v-show="show">
          hello world
        </div>
    </transition>
    <button @click="handleClick">点击显示隐藏</button>
  </div>
  
  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        show: true
      },
      methods: {
        handleClick: function() {
          this.show = !this.show
        }
      }
    })
  
  </script>

</body>
</html>